<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@page import="model.*"%>
<%@page import="persistent.impl.*"%>
<%@page import="persistent.dao.*"%>
<%@page import="java.util.List"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page isELIgnored="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/editcontent.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script> 
<script type="text/javascript" src="js/ajaxfileupload.js"></script> 
<script type="text/javascript">  
	$(function(){  
		$("#btnupload").click(function(){ 
			$("#fileToUpload").click();
		});
		$("#fileToUpload").change(function(){
		
		});
	    //选择文件之后执行上传  
	    $("#fileToUpload").change(function(){ 
	        var userid = $.trim($("#txtuserid").val());
	        var titleid = $("#txtforumid").val(); 
	        var path = userid +'//'+titleid;
	        //alert(path);
	        $.ajaxFileUpload({  
	            url:'fileuploadservlet.do?path=' + path,//$("#txtUserid").val(), 
	            type: "post",   
	            secureuri:false,  
	            fileElementId:'fileToUpload',//file标签的id  
	            dataType: 'json',//返回数据的类型  
	            data:{"titleid":""},//一同上传的数据  
	            success: function (data) {
	                //把图片替换 
	
	                $("#upload").attr("src", "/upload/"+data.result2);  //将图片路径传给<img 
	      			//将返回值中的文件相对路径及名称写入到文本框中 
	      			$("#txtphotopath").val(data.result1); //将资源码传给 <input
						 alert(data.error_msg);     
	            },  
	            error: function (data, status, e) {  
	                alert(e);  
	            }  
	        });  
	    });  
	      
	});  
	</script>
<title>内容编辑-【${forum.serilize}】${forum.topic}</title>
</head>

<body>
<div id = "leftimg"></div>
<div id = "rightimg"></div>
	<div id = "main">
    	<div id= "topic">
        	<span>博文内容编辑</span>
        </div>
        <form id="addcontentform" method = "post" action="saveforumcontent.do">
        <table width="90%">
        	<tr> 
        		<input type="text" id="txtcontentid" name="txtcontentid"  value="${content.contentid }" />
        		<input type="text" id="txtforumid" name="txtforumid"  value="${forum.titleid } " />
        		<input type="text" id="txtuserid" name="txtuserid"  value=" ${forum.userid }" />
        		<td colspan="2" style="width:200px; height:40px; text-align:left">
        		<span style="line-height:40px;color:red">指定该内容为博文代表内容   </span></td>

		<c:if test="${content.isrecommand == false}">
			<td><input style="margin-bottom:-8px;" type="checkbox" name="isrecommand"/></td>
		</c:if>


 
		<c:if test="${content.isrecommand == true}">
				<td><input style="margin-bottom:-8px;" type="checkbox" checked name="isrecommand"/></td>
		</c:if>
				<td class = "back" style="width:120px"><a href="managearticle.do?titleid=${forum.titleid}">《返回文章管理页面</a></td>
			</tr>
			<tr>
				<td colspan = "2" style="height:40px; text-align:left;color:#639">【${forum.serilize}】${forum.topic }</td>
				<td style="width:100px; height:40px; text-align:center; color:#606">
				位置：<input type="text" id = "ordernum" name="ordernum" size="5" onkeyup="value=value.replace(/[^(\d)]/g,'')" value="${content.ordernum }"/>
				</td>
			</tr>
			<tr style="line-height:40px">
				<td style="text-align:left; width:120px">图片上传资源码</td>
				<td style="text-align:left;"><input id="txtphotopath" name="txtphotopath" type="text" size="70" readonly="true" style="color:#999; padding-left:2px" value="/upload/${content.photocontent }"/></td>
				<td style="text-align:center; width:100px"><input id="btnupload" name="upload" type="button"value="上传图片"/>
<!-- 隐藏file标签 -->
		<input id="fileToUpload" style="display:none" type="file" name="upfile"/>
				</td>
			</tr>
			<tr>
				<td style="text-align:center; width:120px">图片预览</td>
				<td colspan="2" style="text-align:left"><img id="upload" src="/upload/${content.photoname }" width="200" height="135" /></td>
			</tr>
			<tr>
				<td style="text-align:center; width:120px">描述内容</td>
				<td colspan="2" style="height:40px; text-align:left">
		<textarea id="textcontent" name="textcontent" cols="75" rows="7" style="resize:none">${content.textcontent }</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="3" style="height:40px; text-align:center">
			<input name="btnsavecontent" type="submit"value="保存更新" />
				</td>
			</tr>
		</table>
		</form>
	</div>
<div class="copyright">
<p>Copyright © 2014 - Software Technology from <a href="http://www.yngsxy.net/"title="云南工商学院" target="_blank">云南工商学院</a></p>
</div>
</body>
</html>
    